using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", false);
// Specifying rectangles for OMR.
const int markCount = 3;
Rectangle[] areas = new Rectangle[markCount];
// Each mark uses a quadruplet for its location (left, top, width, height).
areas[0] = new Rectangle(850, 1580, 30, 30); // First area left, top, width, height.
areas[1] = new Rectangle(850, 1620, 30, 30); // Second area left, top, width, height.
areas[2] = new Rectangle(850, 1660, 30, 30); // Third area left, top, width, height.
int[] filled = gdpictureImaging.OMRDetectMarks(imageID, areas, markCount);
StringBuilder result = new StringBuilder();
for (int index = 0; index < markCount; index++)
{
result.AppendLine("Index:" + index.ToString());
result.AppendLine("Left:" + areas[index].X.ToString());
result.AppendLine("Top:" + areas[index].Y.ToString());
result.AppendLine("Width:" + areas[index].Width.ToString());
result.AppendLine("Height:" + areas[index].Height.ToString());
result.AppendLine("Filled:" + filled[index].ToString());
result.AppendLine();
}
MessageBox.Show(result.ToString(), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}